<?php
class ViewsController extends AppController {

	var $name = 'Views';
	var $uses= array('Category','News');
	function index($id=null) {
			$lang=$this->Session->read('lag');
		if(! $id){
			$name=$_SERVER['HTTP_REFERER'];
			$this->redirect($name);
		}else{
			$this->data=$this->News->read(null,$id);
			$name=$this->Category->findById($this->data['News']['category_id']);
			$this->set('name_Ct',$name['Category']['name']);			
			$this->set('list',$this->News->find('all',array('conditions'=>array('News.id <>'=>$id,'News.status'=>1,'News.category_id '=>$name['Category']['id'],'News.lang_id'=>$lang))));
			
			
		}

	}
}
?>